/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
/**
* Just reads a MaCI pose and ranging files and stores it in "6D format" and in Sensor Frame
* 
* - very quick hack 
* 
*/
#include <math.h>
#include <vector>
#include "owndebug.h"
#include "ownutils.h"
#include "gimutils.h"
#include "TOccupancyGrid.h"


int main(int argc, char *argv[]){
	
	if(argc !=2){
		fprintf(stderr,"\nUsage: ./OccuConvert [in_occu_file]\n");
		exit(1);
	}
	char *occuFile = argv[1];
	TOccupancyGrid gr;
	
	gr.load(occuFile);
	float *dptr = gr.getDataPtr();
	for(int i=0; i<gr.size();i++){
		if(dptr[i]>0.4) dptr[i] = 1.0;
		else dptr[i] = 0;
	}
	
	gr.saveGModel("GlobalMap.gmodel");
	
	return 0;
}